package com.yb.guigu.pick.activity.channel;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.redis.connection.stream.RecordId;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/7/14 17:25
 * FileName: RedisChannel
 * Description:
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RedisChannel implements IRedisChannel{

    private String streamKey;
    private RecordId id;

    private String group;

    private String consumer;
    private StringRedisTemplate stringRedisTemplate;

    private boolean autoAck;

    @Override
    public void cancel() {
    }

    @Override
    public void ack() {

        stringRedisTemplate.opsForStream().acknowledge(streamKey,group,id);
//        stringRedisTemplate.opsForStream().delete(streamKey,id);
    }

    @Override
    public boolean autoAck() {
        return autoAck;
    }


}
